home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Magazin/MacEasy 19
/
Mac Magazin and MacEasy Magazine CD - Issue 19.iso
/
Online
/
LineShare 3.3.1
/
LineShare Scripts
/
Generic ARA&Hermes
< prev
next >
Wrap
Text File
|
1994-01-11
|
6KB
|
303 lines
!$ Version 2.1
!$ Requires: any modem
!$ Supports: ARA and a Hermes BBS software.
!$ Use: ARA/LineShare for ARA.
!$ Read: your modem manual to modify the "AT" strings.
!$ See: the Generic Scripts Guide for details.
^2 Speaker On: = Enum("Never" = "0" , "When Connecting" = "1", "Always"="2") "1"
^3 Speaker Volume: = Enum("Low"="1","Medium"="2","High"="3") "2"
^4 Answer On: = Enum("1 Ring"="1","2 Rings"="2","3 Rings"="3","5 Rings"="5","7 Rings"="7") "2"
^5 Adjust Port Speed: = Bool("Yes"="1","No"="0") "0"
^6 AT for Receive: = Text ""
^7 AT for ARA calls: = Text ""
^8 Max Port Speed: = Enum("2400","9600","19200","38400") "9600"
! ------------------------------------------
! Resetting the modem:
! ------------------------------------------
@Hangup
SetTries 2
Flush
HsReset 0,0,17,19,0,0
!
! Try to catch the "OK" answer, use the Escape seq and DTR transitions
! to enter the command mode
!
@Label 1
matchclr
matchstr 1 2 "OK\r\n"
write "ATH0&FV1\r"
matchread 20
Write "+++"
DtrClear
pause 10
DtrSet
!
DecTries
IfTries 0 1
!
! OSErr -6019 "Modem error - the modem is not responding"
!
exit -6019
@Label 2
exit 0
! ------------------------------------------
! Receiving incoming calls
! ------------------------------------------
@ANSWER
SetVar A ""
IfStr A 50 "^6^7"
@Label 10
SerReset Val("^8"),0,8,1
Jsr 80
!
! Set the common options
Jsr 70
!
! Set the communication options:
! • ^6 for receive mode (disable MNP), <DCE Speed>/ARQ message, hw flow control
Write "AT^6\r"
Jsr 100
!
! Tell the modem to determine the type of the incoming call
! Fetch the tube after ^4 rings
!
Write "ATS0=^4\r"
Jsr 100
Note "Waiting for ARA/BBS calls…"
!
! Everything is ready - let's sit and wait for a call
! We'll wait for 3 minutes, then reinitiate the modem
!
@Label 12
MatchClr
matchstr 1 13 "RING\r\n"
matchstr 2 21 "\r\nCONNECT ^$/"
matchstr 3 15 "\r\nCONNECT ^$\r\n"
matchstr 10 10 "\r\nNO "
matchstr 11 10 "\r\nBUSY"
Matchread 1800
Jump 10
@Label 13
Note "Ring…"
Jump 12
!
! Data connection has been established (we read "CONNECT XXX\r\n")
! Put the "CONNECT" back to the buffer and attach the "Data" subPort
! if it was an incoming call, put the "RING" before the "CONNECT"
!
@Label 15
SetVar A "^$"
Note "Non-V.42 Call at ^A bps. Waiting for an ARA frame."
MatchClr
MatchStr 1 20 "\r"
MatchStr 2 30 "\08\01\03\14\04\03\00\08\250\16\03"
MatchRead 40
@Label 20
Note "Non-ARA call"
Jump 24
!
! V.42 call detected
!
@Label 21
SetVar A "^$"
Note "V.42 Call at ^A bps"
MatchClr
MatchStr 1 24 "\r\n"
MatchRead 5
@Label 24
Jsr 110
QueueInput "^B\r"
@Label 25
Attach "Hermes" (DTR,Escape,IdleLimit=200)
!
! The ARA (MNP 4) frame detected
!
@Label 30
Note "ARA call at ^A bps."
Flush
QueueInput " ^A\r\n"
@Label 31
ifStr 5 32 "1"
QueueInput "\r\nCARRIER "
Jump 35
@Label 32
QueueInput "\r\nCONNECT "
@Label 35
ifOriginate 36
QueueInput "\r\nRING\r\n"
@Label 36
Attach "ARA" (DTR,Escape,TimeLimit=0)
@Label 50
Note "Suspended"
Say "Press the Option button to enter the AT-strings for your modem!"
Pause 1200
Jump 50
! ------------------------------------------
! Originating a call through the "ARA" subport
! ------------------------------------------
@ORIGINATE "ARA"
SerReset Val("^8"),0,8,1
Jsr 80
!
! Set the common options
!
Jsr 70
!
! Set the Data mode:
! • ^7 For ARA calls
! • S7: time-out (90 sec) for long-distance call (if you use them)
!
Write "AT^7S7=90\r"
Jsr 100
!
! Prepare to receive all error result codes
!
Jsr 90
MatchStr 1 31 "\r\nCONNECT"
MatchRead 900
Write "\r"
Exit -6019
! ------------------------------------------
! Originating a call through the "Data" subport
! ------------------------------------------
@ORIGINATE "Hermes"
SerReset Val("^8"),0,8,1
Jsr 80
Jsr 70
!
! Now emit all commands that the application has sent to that port
!
Jsr 60
SerReset *
Jsr 80
!
! Prepare to receive all error result codes
!
Flush
Jsr 90
MatchStr 1 48 "^$\r\nCONNECT"
MatchRead 900
Write "\r"
Exit -6019
@Label 48
QueueInput "^$\r\nCONNECT"
Jump 25
!
! This section emits all modem commands sent from the client application
! For each set of commands the "OK" answer is awaited
!
@Label 60
EmitStart
@Label 61
EmitCommand 62
Jsr 100
Jump 61
@Label 62
return
!
! This section initiates the modem before ANSWER and ORIGINATEs:
! dialtone detect + connect at the highest rate + speaker control +
! hang up on Dtr drop + DCD valid
! Verbal responses mode, no echo
! Disable extended codes
!
@Label 70
Write "ATX4M^2L^3&D2&C1V1E0\r"
Jsr 100
return
!
! This section syncronize the modem after the serial port speed switching
!
@Label 80
ChrDelay 1
Write "AT\r"
ChrDelay 0
Jsr 100
return
!
! Prepare to receive error result codes
!
@Label 90
MatchClr
MatchStr 2 91 "NO DIALTONE\r\n"
MatchStr 3 92 "BUSY\r\n"
MatchStr 4 93 "NO CARRIER\r\n"
MatchStr 5 94 "NO ANSWER\r\n"
Write "ATD^1\r"
HsReset *
return
@Label 91
exit -6020
@Label 92
exit -6022
@Label 93
exit -6021
@Label 94
exit -6023
!
! Processing the AT command:
! OK -> proceed
! ERROR or TimeOut ->exit -6019
! It can be called AFTER the "Write" command, since LineShare buffers input
!
@Label 100
MatchClr
MatchStr 1 102 "\r\nOK\r\n"
MatchStr 2 101 "\r\nERROR\r\n"
MatchRead 20
@Label 101
Exit -6019
@Label 102
return
!
! Converting speed strings -> numbers
!
@Label 110
SetVar B "12"
IfStr A 111 "1200"
IfStr A 112 "2400"
IfStr A 113 "4800"
IfStr A 114 "9600"
IfStr A 115 "12000"
IfStr A 116 "14400"
IfStr A 117 "19200"
IfStr A 118 "38400"
return
@Label 111
SetVar B "5"
return
@Label 112
SetVar B "10"
return
@Label 113
SetVar B "11"
return
@Label 114
SetVar B "12"
return
@Label 115
SetVar B "51"
return
@Label 116
SetVar B "52"
return
@Label 117
SetVar B "16"
return
@Label 118
SetVar B "17"
return